/*
 * 封装全局统一api接口请求全局调用方式 如this.$vueAjax.get()
 */
import axios from '@/utils/request'
// import Vue from 'vue'
import notification from 'ant-design-vue/es/notification'
export default {
  baseUrl: '/api/', // 基础url地址
  login (parameter, self) {
    return new Promise((resolve, reject) => {
      axios({
        url: '/api/Sys_Base_Users/Validate',
        method: 'post',
        data: parameter
      }).then(res => {
        resolve(res)
      }).catch(err => {
        reject(err)
        notification.error({
          message: '网络错误',
          description: err
        })
      })
    })
  },
  get (url, parameter, self) {
    return new Promise((resolve, reject) => {
      axios({
        url: this.baseUrl + url,
        method: 'post',
        data: parameter,
        headers: {
          'Content-Type': 'application/json;charset=UTF-8'
        }
      }).then(res => {
        if (res.Mark) {
          resolve(res)
        } else {
          reject(res)
        }
      }).catch(err => {
        console.log(err)
        notification.error({
          message: '网络错误',
          description: err
        })
      })
    })
  }
}
